package com.ycsyxt.guide;

import java.io.File;
import java.util.LinkedList;

/**
 * @author ycs(15241496739 @ 163.com)
 * @date 2022/6/12
 **/
public class Class13 {
    public static void main(String[] args) {
        // 深度遍历文件
        File file = new File("C:\\Users\\ycs\\Desktop\\md");
        LinkedList<File> stack = new LinkedList<>();
        stack.push(file);
        while (!stack.isEmpty()) {
            File temp = stack.pop();
                System.out.println(temp.getName());
            if (temp.isDirectory()) {
                for (File file1 : temp.listFiles()) {
                    stack.push(file1);
                }
            }
        }
    }
}
